package com.czwj;

import org.mybatis.spring.annotation.MapperScan;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.builder.SpringApplicationBuilder;
import org.springframework.boot.web.servlet.support.SpringBootServletInitializer;
import org.springframework.transaction.annotation.EnableTransactionManagement;


@SpringBootApplication
@EnableTransactionManagement
@MapperScan({"com.czwj.dao"})
public class ConstructManageApplication extends SpringBootServletInitializer {
	
	@Override
    protected SpringApplicationBuilder configure(SpringApplicationBuilder application) {
        return application.sources(ConstructManageApplication.class);
    }
	
	public static void main(String[] args) throws Exception {
//		Process process = Runtime.getRuntime().exec(
//		        new String[] { "wmic", "cpu", "get", "ProcessorId" });
//		process.getOutputStream().close();
//		Scanner sc = new Scanner(process.getInputStream());
//		String property = sc.next();
//		String serial = sc.next();
//		if(CipherUtil.encrypt(serial).equals("fac1bdcfa5a6f6237c3e2ef4f9a4a05f6e8662b6d7f37c27")){
			SpringApplication.run(ConstructManageApplication.class, args);
//		}
		
	}
	
	/**
	 * 
	 * @return
	 */
//  @Bean
//  public TomcatServletWebServerFactory servletContainer() {
//     TomcatServletWebServerFactory tomcat = new TomcatServletWebServerFactory() {
//        @Override
//        protected void postProcessContext(Context context) {
//           SecurityConstraint constraint = new SecurityConstraint();
//           constraint.setUserConstraint("CONFIDENTIAL");
//           SecurityCollection collection = new SecurityCollection();
//           collection.addPattern("/*");
//           constraint.addCollection(collection);
//           context.addConstraint(constraint);
//        }
//     };
//     tomcat.addAdditionalTomcatConnectors(httpConnector());
//     return tomcat;
//  }

//  @Bean
//  public Connector httpConnector() {
//     Connector connector = new Connector("org.apache.coyote.http11.Http11NioProtocol");
//     connector.setScheme("http");
//     //Connector监听的http的端口号
//     connector.setPort(8088);
//     connector.setSecure(false);
//     //监听到http的端口号后转向到的https的端口号
//     connector.setRedirectPort(443);
//     return connector;
//  }
}
